class Solution:
    def minWindow(self, s, t):
        """
        :type s: str
        :type t: str
        :rtype: str
        """
        map = {}
        if s is None or s == "":
            return ""
        for c in t:
            map[c] = map.get(c, 0)+1
        count = 0
        left = 0
        min = len(s)+1
        start = 0
        for right in range(0, len(s)):
            if s[right] in map:
                map[s[right]] = map[s[right]]-1
                if map[s[right]] >= 0:
                    count += 1
                    while count == len(t):
                        if right-left+1 < min:
                            min = right-left+1
                            start = left
                        if s[left] in map:
                            map[s[left]] = map[s[left]]+1
                            if map[s[left]] > 0:
                                count -= 1
                        left += 1
        if min > len(s):
            return ""
        return s[start:start+min]


test = Solution()
print(test.minWindow("aab", "ab"))

